package org.ndx.majick.properties;

import java.beans.PropertyChangeListener;

/**
 * Magick property interface allowing simple get/set and property registration
 * @author Nicolas Delsaux
 */
public interface Property<Type extends Object> {

    /**
     * Classical setter
     * @param newValue
     */
    public void set(Type newValue);

    /**
     * Classical getter
     * @return property value
     */
    public Type get();
    
    /**
     * Gets property name.
     * This property name is used for event sending and listeners registering
     * @return the property name
     */
    public String getName();
    
    /**
     * Gets and return expected data type.
     * @return the type this property is supposed to hold
     */
    public Class<Type> getType();

    /**
     * Adds a property change listener. As a convention, listeners registered using this method will only receive events associated to this property.
     * @param listener
     */
    public void addPropertyChangeListener(PropertyChangeListener listener);

    public void removePropertyChangeListener(PropertyChangeListener listener);
}
